<template>
    <div v-if="isShow">
        <img src="@/assets/image/weixin/index.jpg" class="qyimg"/>
        <el-row>
            <el-button type="primary" round @click="go('CompanyInfoWx')">企业信息</el-button>
            <el-button type="primary" round @click="go('InWorkHumanWx')">员工基本情况</el-button>
            <el-button type="primary" round @click="go('DynamicHumanWx')">动态人力资源信息</el-button>
            <el-button type="primary" round @click="logOut">安 全 退 出</el-button>
        </el-row>
    </div>
</template>

<script lang="ts">
    import {Component} from 'vue-property-decorator'
    import {mixins} from "vue-class-component";
    import BaseVue from "@/core/mixin/BaseVue";
    import Kit from "@/core/mixin/Kit";
    import {TagsViewModule} from "@/core/store/modules/tags-view";
    import {getRoleCodes, removeAllCache} from "@/core/utils/storage";
    import {UserModule} from "@/core/store/modules/user";

    @Component({
        name: 'WxIndex'
    })
    export default class WxIndex extends mixins(BaseVue, Kit) {
        isShow = false;

        /**
         * 如果是 NC 系统管理员登录，直接踢走
         */
        created() {
            this.isShow = false;
            let isSystem = getRoleCodes().indexOf("system") != -1;
            if (isSystem) {
                TagsViewModule.delViewByRoute(this.$route);
                this.go("/government/company/list")
                return;
            }
            this.isShow = true;
        }

        logOut() {
            TagsViewModule.delAllCachedViews();
            TagsViewModule.delAllViews();
            UserModule.LogOut();
            removeAllCache();
            this.$router.push(`/login?redirect=/weiXin/WxIndex`)
        }
    }
</script>

<style lang="scss" scoped>
    .qyimg {
        display: block;
        width: 200px;
        margin: 30px auto;
    }

    .el-button {
        display: block;
        width: 200px;
        height: 40px;
        margin: 20px auto;
        font-size: 16px;
        box-shadow: 0 2px 7px rgba(50, 96, 251, 0.1);
    }
</style>
